

#ifndef __NAPI_TEST_H__
#define __NAPI_TEST_H__

#include "napi/native_api.h"
#include <js_native_api_types.h>

#include <iostream>

#define NAPI_CLASS_NAME "NapiTestClass"

class NapiTest {
public:
  NapiTest() : mEnv(nullptr), mRef(nullptr) {
  }
  NapiTest(napi_env env) : mEnv(env), mRef(nullptr){
  }
  ~NapiTest();

  static napi_value Create(napi_env env, napi_callback_info info);
  static napi_value Init(napi_env env, napi_value exports);
  
private:
    static napi_value SetMsg(napi_env env, napi_callback_info info);
    static napi_value GetMsg(napi_env env, napi_callback_info info);
    
    static napi_value Constructor(napi_env env, napi_callback_info info);
    static void Destructor(napi_env env, void *nativeObject, void *finalize);
    
    static napi_ref sConstructor_;
    static std::string _msg;
    
    napi_env mEnv = nullptr;
    napi_ref mRef = nullptr;
};

#endif  /* __NAPI_TEST_H__ */